import { defineStore } from 'pinia'
import { ref } from 'vue'

//用户模块token setToken removeToken

export const userUserStore = defineStore(
    'user',
    () => {
        const token = ref('')
        const setToken = (newToken) => {
            token.value = newToken
        }
        const removeToken = () => {
            token.value = ''
        }
        const userInfo = ref('')
        const setUserInfo = (newUserInfo) => {
            userInfo.value = newUserInfo
        }
        const removeUserInfo = () => {
            userInfo.value = ''
        }
        return {
            token,
            setToken,
            removeToken,
            userInfo,
            setUserInfo,
            removeUserInfo
        }
    },
    {
        persist: true
    }
)
